AJAX_iframe实现Ajax文件上传效果示例,复制代码 代码如下: span styl
iframe.src='do_upload.php';
<span>avascript部分</span>
iframe.style.height='0px';
<body>
</body>
"<script>
}
复制代码 代码如下:
msg.innerHTML='<font color=red>$msg</forn>';?>
<?php
</html>
$save_name=rand().$up_file['name'];
$up_file=$_FILES['myFile'];
复制代码 代码如下:
$msg='上传失败!';iframe.style.width='0px';
mkdir('./imgs');
请选择文件:<input type='file'/><br/>
$bool=move_uploaded_file($up_file['tmp_name'],"./imgs/$save_name");
复制代码 代码如下:
echo<form enctype='multipart/form-data' method='post' action='do_upload.php'>
form.target=iframe_name;
window.onload=function(){
</head>
if($up_file['error']===0){
if($bool){
if(!file_exists('./imgs')){
}else{
</script>";
}
<head>
form.onsubmit=function(){
<!doctype html>
}
<title>ajax 文件上传~~</title>
var iframe=document.createElement('iframe');
var iframe_name="iframe"+Math.random();
<input type='submit'/>
<html>
$msg='上传成功!';
</form>
document.body.appendChild(iframe);
<div></div>
<head>
<script>
var form=document.getElementsByTagName('form')[0];
}
<meta charset=utf-8>
iframe.name=iframe_name;
iframe.frameBorder='0';
var msg=parent.document.getElementById('msg');
//php接收部分
相关热词:
本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!
本文地址: https://v30.fanwenzhu.com/jq/ui/6208.shtml
